/**
 * @param {number[]} nums
 * @return {number}
 */
 var minimizeArrayValue = function(nums) {
    let sum = 0;
    let ans = 0;
    for(let i = 0; i < nums.length; i++){
        sum += nums[i];
        let tmp = (sum + i) / (i + 1);
        ans = Math.max(ans, tmp);
    }
    return Math.floor(ans);
};
let nums = [3,7,1,6];
nums = [13,13,20,0,8,9,9];
nums = [4,7,2,2,9,19,16,0,3,15];
console.log(minimizeArrayValue(nums));